Skip to content

After connecting an app from a Bot's card, the sign-in's tab closes and you're back with the Bot - #2071

Merged
davidmckayv merged 1 commit into
mainfrom
fix/connect-returns-to-conversation
Nov 23, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
fix/connect-returns-to-conversation

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

What this changes

Connect on a Bot's card in a conversation, or on an app row on a Bot's page, opens the sign-in in a new tab. The connect route brings a browser back to the app's page under Connections, so after connecting Gmail from a conversation the person was left on Gmail's page in the new tab. They expected to be back with the Bot, which by then was already carrying on in the first tab.

  • Before the claimed tab leaves OpenBot, it's given a note in its own session storage: which app, and where Connect was pressed (app/src/lib/plugins/connect-return.ts, written from useConnectInNewTab).
  • The app's page under Connections reads and drops the note on arrival. Once the account is listed as connected (a withdrawn credential doesn't count), it closes the tab, which puts the person back on the tab they pressed Connect in. Where the browser won't let it close, it goes back to that page instead.
  • A sign-in that came back failed (?status=failed, ?connected=failed) leaves the person on the app's page, where the failure is said. With no note (Settings' own Connect, which navigates its own tab, or storage refused), nothing changes.
  • OpenBot Desktop's window opens no tab, so nothing changes there.

Where it runs

Browser only. Nothing on the server changes.

  • New state that outlives a request? None on the server. One session-storage entry in the sign-in tab, dropped on arrival.
  • What happens on the second replica? Nothing different: no server code changes.
  • Anything serialised? No.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No.

Boundary and audit

  • Every acting call still goes through the gateway: no change.
  • New refusals and new failures each write a row: there are none.
  • Nothing new is trusted from the client. The note only ever names a path in OpenBot (it must start with / and not //).

API and database

  • This changes nothing under api/, no app's requests, no database change and no release-policy.json.

Changelog

  • A line in CHANGELOG.md under Unreleased, Smaller changes.

Proof

  • Two new real-browser cases in app/tests/consent-handoff.test.tsx, which drive the real card, the real /connecting step and the real app page: the tab a Bot's card opened closes once Gmail is connected, and, with window.close refused, the tab goes back to the card. Both fail on main (run against main's two source files) and pass with this change.
  • OPENBOT_APP_BROWSER=1 OPENBOT_APP_ENGINES=chromium,webkit bun test app/tests/consent-handoff.test.tsx: 24 pass, 0 fail.
  • The connect-card, app-access and connection-page suites (19 files): all pass.
  • bun run typecheck in app/ and biome check on the changed files are clean.

…nd you're back with the Bot

Connect on a Bot's card (or an app row on a Bot's page) opens the sign-in in a new tab, and the
connect route brings a browser back to the app's page under Connections. So after connecting Gmail
from a conversation the person was left on Gmail's page in that tab, while the Bot was already
carrying on in the first one.

The tab the card claims is now told, before it leaves OpenBot, where Connect was pressed: written
into that tab's own session storage. The app's page reads and drops the note on arrival, and once
the account is listed as connected it closes the tab, or, where the browser won't close it, goes
back to where Connect was pressed. A sign-in that came back failed leaves the person where the
failure is said.

Two real-browser cases in consent-handoff.test.tsx (Chromium and WebKit): the tab closes once Gmail
is connected, and goes back to the card where closing is refused. Both fail on main.
@davidmckayv
davidmckayv merged commit afeb878 into main Nov 23, 2026
42 of 44 checks passed
@davidmckayv
davidmckayv deleted the fix/connect-returns-to-conversation branch November 23, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant